// pages/topic/topic.js
var config = require('../../config')
var util = require('../../utils/util.js')
Page({

  /**
   * 页面的初始数据
   */
  data: {
    topic:{}
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    this.getTopic(options.id)
  },
  // 用户登录示例
  getTopic: function (id) {
    var that = this
    var options = {
      url: config.service.requesTopicstUrl+'/'+id,
      success(result) {
        that.setData({
          topic: result.data.data
        })
      },
      fail(error) {
        util.showModel('请求失败', error);
        console.log('request fail', error);
      }
    }
    wx.request(options)
  },
})